package com.passcheck.runner;

import com.common.cache.CacheCommon;
import com.common.properties.ConfigProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @author ZhangHaiWen
 * @title: Runner
 * @projectName minipasscheck
 * @description: 启动时将所有的配置信息加载到内存中
 * @date 2021/1/1911:44
 */
@Slf4j
@Component
public class PropertiesLoadRunner implements ApplicationRunner {
    /**
     * 将配置文件中的类读取到 内存中
     * @param args
     * @throws Exception
     */
    @Override
    public void run(ApplicationArguments args) throws Exception {
        // 加载配置信息到缓存中
        log.info("lode properties start");
        ConfigProperties configProperties = ConfigProperties.getInstance("conf/config.properties");
        configProperties.loadPros(CacheCommon.PROPERTIES_CACHE);

        log.info("lode properties end");
    }
}
